<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ include file="/WEB-INF/views/include/header.jsp"%>
<form:form commandName="summary" cssClass="form-horizontal"
	role="form" onsubmit="return false;">

	<div class="form-group">
		<label class="col-sm-1 control-label no-padding-right"
			   for=projectName>项目名称</label>
		<div class="col-sm-5">
			<input type="text"  id="projectName" readonly="readonly"
				   placeholder="请输入项目名称"  name="projectName" value="${summary.projectName}"
				   class="form-control required">
		</div>

	</div>
	<div id="zmjz-list">
		<c:forEach var="content" items="${debriefingFilter.contents}" varStatus="status">
			<div class="form-group">
				<label class="col-sm-1 control-label no-padding-right">日期</label>
				<div class="col-sm-3">
					<div class="row">
						<div class="col-xs-8 col-sm-12">
							<div class="input-group">
								<input type="text" name="contents[${status.count-1}].datetime" value="${content.datetime}" class="form-control date-picker" readonly/>
								<span class="input-group-addon"><i class="fa fa-calendar bigger-110"></i></span>
							</div>
						</div>
					</div>
				</div>
				<label class="col-sm-1 control-label no-padding-right">项目进展</label>
				<div class="col-sm-5">
					<input type="text" name="contents[${status.count-1}].projectDebriefing" value="${content.projectDebriefing}" placeholder="请输入项目进展"  class="form-control required" >
				</div>
                <input type="text" name="contents[${status.count-1}].updateTime" value="${content.updateTime}" placeholder="请输入项目进展"  class="form-control required" style="display: none"  >

            </div>
		</c:forEach>
	</div>

	<div class="form-group">
		<button class="col-sm-12 btn btn-large btn-primary" id="add-form">+</button>
	</div>
	<div class="form-group">
		<label class="col-sm-1 control-label no-padding-right" for="taxproof">佐证材料</label>
		<input class="col-sm-5" type="file" id="fileupload" name="files"
			accept=".zip"><br>

		<button class="col-sm-5 btn btn-large btn-primary" id="btn">上传</button>

		<input type="text" name="taxproof" id="taxproof"
			value="${debriefingFilter.taxproof}" class="form-control  "
			style="display: none" >

	</div>
   <input type="text" name="summaryId" id="summaryId"
           value="${summary.sysId}" class="form-control "
          style="display: none" >
	<form:hidden path="sysId" />
</form:form>
<%--<script src="<s:url value="/assets/js/chosen.jquery.js"></s:url>"></script>--%>
<script src="<s:url value="/assets/js/ajaxfileupload.js"></s:url>"></script>
<%--<script src="<s:url value="/assets/js/jquery-ui.js"></s:url>"></script>--%>
<%--
<script src="<s:url value="/assets/css/jquery-ui.css"></s:url>"></script>
--%>


<%--<div id="dialog" title="提示">
	<div class="progress progress-striped active">
		<div class="progress-bar progress-bar-success" role="progressbar"
			aria-valuenow="60" aria-valuemin="0" aria-valuemax="100"
			style="width: 100%;"></div>

	</div>
	<p>正在上传 请稍后……</p>
</div>--%>

<script type="text/javascript">

	$('#add-form').on('click', function () {
        var addNum = $('#zmjz-list .form-group').length;
	    var html = '<div class="form-group">\n' +
            '\t\t\t\t<label class="col-sm-1 control-label no-padding-right">日期</label>\n' +
            '\t\t\t\t<div class="col-sm-3">\n' +
            '\t\t\t\t\t<div class="row">\n' +
            '\t\t\t\t\t\t<div class="col-xs-8 col-sm-12">\n' +
            '\t\t\t\t\t\t\t<div class="input-group">\n' +
            '\t\t\t\t\t\t\t\t<input type="text" name="contents['+addNum+'].datetime" value="" class="form-control date-picker" readonly/>\n' +
            '\t\t\t\t\t\t\t\t<span class="input-group-addon"><i class="fa fa-calendar bigger-110"></i></span>\n' +
            '\t\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t</div>\n' +
            '\t\t\t\t</div>\n' +
            '\t\t\t\t<label class="col-sm-1 control-label no-padding-right">项目进展</label>\n' +
            '\t\t\t\t<div class="col-sm-5">\n' +
            '\t\t\t\t\t<input type="text" name="contents['+addNum+'].projectDebriefing" value="" placeholder="请输入项目进展"  class="form-control " >\n' +
            '\t\t\t\t</div>\n' +
            '\t\t\t\t<input type="text" name="contents['+addNum+'].updateTime" value="" placeholder=""  class="form-control " style="display: none" >\n' +
            '\t\t\t</div>';
		$('#zmjz-list').append(html);
        addNum++;
        $('.date-picker').datepicker({
            inline: true,
            format:"yyyymmdd",
            autoclose: true,
            todayHighlight: true,
            language: 'cn'
        }).next().on(ace.click_event, function() {
            $(this).prev().focus();
        });
    });
	//$("#dialog").hide();
	$("#btn").click(function() {
		var fileval = $("#fileupload").val();
		if (fileval == null || fileval == "") {
            $(".shade").fadeIn(100);
            $(".warning").fadeIn(100);
            $('.la-square-jelly-box').hide();
            $('.warning>.title>em').html('未选择上传文件');
            showShade();
			return;
		}
        $(".shade").fadeIn(100);
        $(".warning").fadeIn(100);
        $('.la-square-jelly-box').show();
        showShade();
        //警告框自定义内容
        $('.warning>.title>em').html('加载中……');
		/*$("#dialog").show();
		$("#dialog").dialog();*/
		$.ajaxFileUpload({
			type : "post",
			fileElementId : "fileupload",
			secureuri : false,
			dataType : 'json',
			url : "/pictureUpload/uploadBatch",
			async : false,
			success : function(data) {
				var val = data.data.sysid;
				console.log("sds"+val);
				$("#taxproof").attr("value", val);
                $("#taxproof").attr("value", val); //taxproof 作为存放作证材料的字段
                /*$("#dialog").dialog("close");*/
                $('.warning>.title>em').html('上传成功');
                $('#btn').html('文件已上传');
			},
			error : function(data) {

				alert("佐证材料上传失败 ！！请联系管理员");
			}

		});

	});

    jQuery(function($) {
        $('.date-picker').datepicker({
            inline: true,
            format:"yyyymmdd",
            autoclose: true,
            todayHighlight: true,
            language: 'cn'
        })
        //show datepicker when clicking on the icon
            .next().on(ace.click_event, function(){
            $(this).prev().focus();
        });
    });

/*

            $( "#timepick0").datepicker({
                dayNamesMin : ["日", "一", "二", "三", "四", "五", "六"],
                firstDay : 1,
                monthNames : ["01", "02", "03", "04", "05", "06",
                    "07", "08", "09", "010", "11", "12"],
                showMonthAfterYear : true,
                yearSuffix : "-",
                dateFormat : "yyMMdd",

            });

    $( "#timepick1").datepicker({
        dayNamesMin : ["日", "一", "二", "三", "四", "五", "六"],
        firstDay : 1,
        monthNames : ["01", "02", "03", "04", "05", "06",
            "07", "08", "09", "010", "11", "12"],
        showMonthAfterYear : true,
        yearSuffix : "-",
        dateFormat : "yyMMdd",

    });
    $( "#timepick2").datepicker({
        dayNamesMin : ["日", "一", "二", "三", "四", "五", "六"],
        firstDay : 1,
        monthNames : ["01", "02", "03", "04", "05", "06",
            "07", "08", "09", "010", "11", "12"],
        showMonthAfterYear : true,
        yearSuffix : "-",
        dateFormat : "yyMMdd",

    });
    $( "#timepick3").datepicker({
        dayNamesMin : ["日", "一", "二", "三", "四", "五", "六"],
        firstDay : 1,
        monthNames : ["01", "02", "03", "04", "05", "06",
            "07", "08", "09", "010", "11", "12"],
        showMonthAfterYear : true,
        yearSuffix : "-",
        dateFormat : "yyMMdd",

    });
    $( "#timepick4").datepicker({
        dayNamesMin : ["日", "一", "二", "三", "四", "五", "六"],
        firstDay : 1,
        monthNames : ["01", "02", "03", "04", "05", "06",
            "07", "08", "09", "010", "11", "12"],
        showMonthAfterYear : true,
        yearSuffix : "-",
        dateFormat : "yyMMdd",

    });
    $( "#timepick5").datepicker({
        dayNamesMin : ["日", "一", "二", "三", "四", "五", "六"],
        firstDay : 1,
        monthNames : ["01", "02", "03", "04", "05", "06",
            "07", "08", "09", "010", "11", "12"],
        showMonthAfterYear : true,
        yearSuffix : "-",
        dateFormat : "yyMMdd",

    });
    $( "#timepick6").datepicker({
        dayNamesMin : ["日", "一", "二", "三", "四", "五", "六"],
        firstDay : 1,
        monthNames : ["01", "02", "03", "04", "05", "06",
            "07", "08", "09", "010", "11", "12"],
        showMonthAfterYear : true,
        yearSuffix : "-",
        dateFormat : "yyMMdd",

    });
    $( "#timepick7").datepicker({
        dayNamesMin : ["日", "一", "二", "三", "四", "五", "六"],
        firstDay : 1,
        monthNames : ["01", "02", "03", "04", "05", "06",
            "07", "08", "09", "010", "11", "12"],
        showMonthAfterYear : true,
        yearSuffix : "-",
        dateFormat : "yyMMdd",

    });
*/


	/*var isauditval = $("#isaudit").val();
	console.log(isauditval);
	if(isauditval=='1'){
		$("#updatebtn").attr("disabled", true);
		console.log(isauditval+"111");
	}*/
	
	/*function findtwoClass() {
		var teamID = $("#teamClassId").val();
		var teamClassname = $("#teamClassId").find("option:selected").text();
		$("#teamClass").attr("value",teamClassname);
        //console.log(teamID);
		//alert(teamID);
		var teamcla = {
			"teamId" : teamID
		};

		$.ajax({
			url : "/chart/show/getTeamclassNames",
			dataType : "json", //返回数据形式为json
			type : "POST",
			contentType : 'application/json;charset=UTF-8',
			data : JSON.stringify(teamcla),
			success : function(data) {
				$("#teamname option").remove();
				$("#teamname").append(" <option value='00'>请选择</option>");
				for (var i = 0; i < data.data.length; i++) {
					var teamid = data.data[i].teamId;
					var teamname = data.data[i].teamName;
					$("#teamname").append(
							"<option value='"+teamname+"'>" + teamname
									+ "</option>");
					//console.log(teamname);
				}
			}
		});

	}*/

    // 警告框
    function showShade(){
        var $vW = $(window).width();
        var $w = $(".warning").outerWidth();
        var $vH = $(window).height();
        var $h = $(".warning").outerHeight();
        $(".warning").css({"left":($vW - $w)/2 + "px","top":($vH - $h)/3 + "px"});
    };
    //警告框
    $(function(){
        //浏览器大小发生改变
        $(window).resize(function(){
            showShade();
        });
        //点击span关闭
//         $("span").bind("click",function(){
//             $(".shade").fadeOut(100);
//             $(".warning").fadeOut(100);
//         });
//         //绑定键盘事件  按下esc键退出
//         $(document).keyup(function(ev){
// //                alert(ev.keyCode);  获取esc的键码27
//             if(ev.keyCode == 27){
// //                    $("span").click();
//                 //模拟事件
//                 $("span").trigger("click");
//             }
//         })
//         $('.shade').click(function () {
//             $("span").trigger("click");
//         })
    })
</script>
